package com.forum.core.util;

import org.apache.commons.lang.RandomStringUtils;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.UUIDHexGenerator;

/**
 * @Company <Jinher Technology Development Company LTD.>
 * @Project <Jinher Collaboration Suite>
 * @version <1.0>
 * @Author  <yangzq>
 * @Date    <Jun 24, 2009>
 * @description uuid 自动生成程序
 */
public class UUIDUtil {

	public static String getUUID(){
		IdentifierGenerator uuid = new UUIDHexGenerator();
        try {
            return uuid.generate(null, null).toString();
        } catch (Exception ex) {
            return RandomStringUtils.randomAlphabetic(19)+ System.currentTimeMillis();//19 + 13
        }
	}
	
	public static void main(String[] args) {
		System.out.println(getUUID().length()); 
	}
}
